package game;

import com.jme3.app.state.AbstractAppState;
import com.jme3.app.state.AppStateManager;
import de.lessvoid.nifty.Nifty;
import de.lessvoid.nifty.screen.Screen;
import de.lessvoid.nifty.screen.ScreenController;
import player.HumanPlayer;

public class GuiAppState extends AbstractAppState implements ScreenController {

    public void bind(Nifty nifty, Screen screen) {
        //TODO setup nifty
    }

    public void onStartScreen() {
        
    }

    public void onEndScreen() {
        
    }
    
    @Override
    public void stateAttached(AppStateManager stateManager) {
        super.stateAttached(stateManager);
    }
    
    @Override
    public void stateDetached(AppStateManager stateManager) {
        super.stateDetached(stateManager);
    }
    
    @Override
    public void update(float tpf) {
        if(TurnController.getCurrentPlayer() instanceof HumanPlayer) {
            if(StateController.getTurnAppState().isTurnInputHandlerAttached() && TurnController.getCurrentHumanPlayer().hasSelectedCharacter()) {
                int ticksRemainingForSelectedChar = ResolutionController.TICKS_PER_RESOLUTION - TurnController.getCurrentHumanPlayer().getSelectedCharacter().getActionQueue().getTicksQueued();
                Main.ticksText.setText("Ticks Remaining: " + ticksRemainingForSelectedChar);
            } else {
                Main.ticksText.setText(" ");
            }
        } else {
            Main.ticksText.setText(" ");
        }
    }
}
